package com.training.admin.dao;

import java.util.List;

import com.demo2do.core.persistence.annotation.Dao;
import com.demo2do.core.persistence.annotation.Query;
import com.demo2do.core.persistence.annotation.Variable;
import com.training.admin.entity.trainee.IdmUser;

/**
 * @author xiaoHU
 *
 */
@Dao("hibernate")
public interface IdmUserDao {
    
    /**
     * @param idmUserIds
     */
    @Query("DELETE FROM IdmUser")
    public void deleteAll();

    /**
     * @param usercn
     * @param mail
     * @param mobile
     * @param alias
     * @return
     */
    @Query("FROM IdmUser WHERE usercn LIKE :usercn OR mail LIKE :mail OR mobile LIKE :mobile OR alias LIKE :alias")
    public List<IdmUser> listBySearch(@Variable("usercn") String usercn, @Variable("mail") String mail, @Variable("mobile") String mobile, @Variable("alias") String alias);

    /**
     * @param traineeIds
     * @return
     */
    @Query("FROM IdmUser WHERE id in (:traineeIds)")
    public List<IdmUser> listByIds(@Variable("traineeIds") List<Long> traineeIds);
    
    /**
     * 
     * @param email
     * @return
     */
    @Query("FROM IdmUser WHERE mail =:email")
    public IdmUser loadByEmail(@Variable("email") String email);
}
